package com.party.common.config;


import org.springframework.context.annotation.Configuration;

/**
 * 微信配置类
 */
@Configuration
public class WeChatConfig {


    /**
     * 公众号appid
     */
//    @Value("${wxpay.appid}")
    private String appId="wxd3a921cb1ec69ba8";
//    private String appId="wx330938cba2ec9b1c";

    /**
     * 公众号秘钥
     */
//    @Value("${wxpay.appsecret}")
    private String appsecret="d6c9624e769b924e3917af3bd287701b";
//    private String appsecret="8f21ef90bbc701fc7068b65f167ad02c";


    /**
     * 开放平台appid
     */
//    @Value("${wxopen.appid}")
    private String openAppid;

    /**
     * 开放平台appsecret
     */
//    @Value("${wxopen.appsecret}")
    private String openAppsecret;


    /**
     * 开放平台回调url
     */
//    @Value("${wxopen.redirect_url}")
    private String openRedirectUrl;

//    @Value("${wx.binding_redirect_url}")
    private String bindingRedirectUrl;


//    @Value("${wx.scan_binding_redirect_url}")
    private String scanBindingRedirectUrl;

//    @Value("${wx.scan_binding_redirect_url_h5}")
    private String scanBindingRedirectUrlH5;

//    @Value("${wx.scan_unbinding_redirect_url}")
    private String scanUnBindingRedirectUrl;

//    @Value("${wx.scan_unbinding_redirect_url_h5}")
    private String scanUnBindingRedirectUrlH5;


    /**
     * 微信开放平台二维码连接
     */
    private final static String OPEN_QRCODE_URL= "https://open.weixin.qq.com/connect/qrconnect?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_login&state=%s#wechat_redirect";


    /**
     * 开放平台获取access_token地址
     */
    private final static String OPEN_ACCESS_TOKEN_URL="https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code";


    /**
     * 获取用户信息
     */
    private final static String OPEN_USER_INFO_URL ="https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN";


    private final static String CGI_BIN_ACCESS_TOKEN_URL="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";


    private final static String CGI_BIN_GET_TICKET_URL="https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi";


    /**
     * 商户号id
     */
//    @Value("${wxpay.mer_id}")
    private String mchId="1526027941";
//    private String mchId="1634872364";


    /**
     * 支付key
     */
//    @Value("${wxpay.key}")
//    private String key="Mojiweather1513TOB15mojitianqi15";
//    private String key="53F7ECCE4F12219C383F2B7B4D7081A5B4ED58D2";
    private String key="Mojiweather1513TOB15mojitianqiV2";
//    private String key="06bd7a6eb941a3400f230a88d962a75a";

    /**
     * 微信支付回调url
     */
//    @Value("${wxpay.callback}")
    private String payCallbackUrl="http://47.93.153.16:8082//web/wechat/order/callback";
//    private String payCallbackUrl="https://soergocloud.net/service/api/wechat/order/callback";


    /**
     * 统一下单url
     */
    private static final String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";


    public static String getUnifiedOrderUrl() {
        return UNIFIED_ORDER_URL;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getPayCallbackUrl() {
        return payCallbackUrl;
    }

    public void setPayCallbackUrl(String payCallbackUrl) {
        this.payCallbackUrl = payCallbackUrl;
    }

    public static String getOpenUserInfoUrl() {
        return OPEN_USER_INFO_URL;
    }

    public static String getOpenAccessTokenUrl() {
        return OPEN_ACCESS_TOKEN_URL;
    }

    public static String getOpenQrcodeUrl() {
        return OPEN_QRCODE_URL;
    }

    public String getOpenAppid() {
        return openAppid;
    }

    public void setOpenAppid(String openAppid) {
        this.openAppid = openAppid;
    }

    public String getOpenAppsecret() {
        return openAppsecret;
    }

    public void setOpenAppsecret(String openAppsecret) {
        this.openAppsecret = openAppsecret;
    }

    public String getOpenRedirectUrl() {
        return openRedirectUrl;
    }

    public void setOpenRedirectUrl(String openRedirectUrl) {
        this.openRedirectUrl = openRedirectUrl;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppsecret() {
        return appsecret;
    }

    public void setAppsecret(String appsecret) {
        this.appsecret = appsecret;
    }

    public String getBindingRedirectUrl() {
        return bindingRedirectUrl;
    }

    public void setBindingRedirectUrl(String bindingRedirectUrl) {
        this.bindingRedirectUrl = bindingRedirectUrl;
    }

    public String getScanBindingRedirectUrl() {
        return scanBindingRedirectUrl;
    }

    public void setScanBindingRedirectUrl(String scanBindingRedirectUrl) {
        this.scanBindingRedirectUrl = scanBindingRedirectUrl;
    }

    public String getScanUnBindingRedirectUrl() {
        return scanUnBindingRedirectUrl;
    }

    public void setScanUnBindingRedirectUrl(String scanUnBindingRedirectUrl) {
        this.scanUnBindingRedirectUrl = scanUnBindingRedirectUrl;
    }

    public String getScanBindingRedirectUrlH5() {
        return scanBindingRedirectUrlH5;
    }

    public void setScanBindingRedirectUrlH5(String scanBindingRedirectUrlH5) {
        this.scanBindingRedirectUrlH5 = scanBindingRedirectUrlH5;
    }

    public String getScanUnBindingRedirectUrlH5() {
        return scanUnBindingRedirectUrlH5;
    }

    public void setScanUnBindingRedirectUrlH5(String scanUnBindingRedirectUrlH5) {
        this.scanUnBindingRedirectUrlH5 = scanUnBindingRedirectUrlH5;
    }

    public static String getCgiBinAccessTokenUrl() {
        return CGI_BIN_ACCESS_TOKEN_URL;
    }

    public static String getCgiBinGetTicketUrl() {
        return CGI_BIN_GET_TICKET_URL;
    }
}
